package lianxi4;
//小时工类
public class HourlyEmployee extends ColaEmployee{
    private double hourSalary;
    private double hour;

    public HourlyEmployee(String name, int birthMonth, double hourSalary, double hour) {
        super(name, birthMonth);
        this.hourSalary = hourSalary;
        this.hour = hour;
    }

    @Override
    public double getSalary(int month) {
        if (hour > 160) {
            if (getBirthMonth() == month)
                return hourSalary*160 + (hour - 160) * hourSalary*1.5 + 100;
            else
                return hourSalary*160 + (hour - 160) * hourSalary*1.5;
        } else {
            if (getBirthMonth() == month)
                return hourSalary *hour+ 100;
            else
                return hourSalary*hour;
        }
    }
}
